package controllers

import (
	"github.com/gin-gonic/gin"
	"gowww/comeon/services"
	"net/http"
)

//
//  TaobaoPasswd
//  @Description: 淘口令
//  @param c
//
func TaobaoPasswd(c *gin.Context) {

	var taobaoService = services.Taobao{}
	url := c.PostForm("url")

	resp, err := taobaoService.GetTbPasswd(url)
	if err != nil {
		c.JSON(http.StatusOK, gin.H{
			"code":    0,
			"message": err.Error(),
		})
	} else {
		c.JSON(http.StatusOK, gin.H{
			"code": 200,
			"data": resp,
		})
	}
}

//
//  GetOrderByTaobao
//  @Description:
//  @param c
//
func GetOrderByTaobao(c *gin.Context) {
	var service = services.Taobao{}

	resp, err := service.GetOrder()
	if err != nil {
		c.JSON(http.StatusOK, gin.H{
			"code":    0,
			"message": err.Error(),
		})
	} else {
		c.JSON(http.StatusOK, gin.H{
			"code": 200,
			"data": resp,
		})
	}
}
